// UserRatingGroupingComparator.java
import java.io.IOException;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;
public class UserRatingGroupingComparator extends WritableComparator {
    protected UserRatingGroupingComparator() {
        super(UserRatingKey.class, true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        UserRatingKey keyA = (UserRatingKey) a;
        UserRatingKey keyB = (UserRatingKey) b;
        return keyA.getUserId().compareTo(keyB.getUserId());
    }
}
